<template>
	<view>
		<view class="l1" v-for="item in doctor">
			<view class="l2">
				<u-avatar :src="'http://124.93.196.45:10001'+item.avatar"></u-avatar>
				<text>{{item.name}}</text>
			</view>
			<text>职称：{{item.jobName}}</text>
			<text>职业编号：{{item.practiceNo}}</text>
		</view>
		<view class="l3">
			<text style="font-size: 25px;">问题描述</text>
			<view class="l4">
				<textarea placeholder="请描述您的问题" v-model="value"></textarea>
				<view class="l5">
					<u-upload @afterRead="afterRead" :multiple="true" :fileList="tupian" :previewImage="true"></u-upload>
				</view>
			</view>
		</view>
		<view class="l6" v-for="item in tupian">
			<image :src="item.url" style="width: 150px; height: 100px;"></image>
		</view>
		<u-button type="primary" text="提交" style="margin-top: 20px;" @click="tijiao"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:'',
				doctor:[],
				value:'',
				tupian:[]
			}
		},
		onLoad(options) {
			this.name=options.name
			this.getdoctor()
		},
		methods: {
			getdoctor(){
				this.api.get('/prod-api/api/pet-hospital/pet-doctor/list?name='+this.name).then(res=>{
					this.doctor=res.data.rows
				})
			},
			afterRead(event) {
				console.log(event)
				for(let i=0;i<event.file.length;i++){
					this.tupian.push(event.file[i].url)
				}
				console.log(this.tupian)
			},
			tijiao(){
				if(this.value===''){
					uni.showToast({
						title:'内容为空',
						icon:'error'
					})
				}else{
					uni.showToast({
						title:'提交成功'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
.l1{
	width: 300px;
	border: 2px solid deeppink;
	margin: 20px auto;
	display: flex;
	flex-direction: column;
}
.l3{
	.l4{
		display: flex;
		margin: 20px auto;
		width: 300px;
		// height: 150px;
		border: 2px solid mediumpurple;
	}
}
</style>
